import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Hashmap {
    public static void main(String[] args) {
        HashMap<String, Student> hashMap = new HashMap<String, Student>();
        hashMap.put("001",new Student("xiaoming",20));
        hashMap.put("002",new Student("xiaohong",21));
        hashMap.put("003",new Student("xiaocan",22));
        hashMap.put("004",new Student("xiaogang",25));

        Set<String> keySet = hashMap.keySet();
        for (String s : keySet) {
            Student student = hashMap.get(s);
            System.out.println("key值为"+s+"学生对象为"+student);
        }

        System.out.println("---------------------------------------------");
        Set<Map.Entry<String, Student>> entrySet = hashMap.entrySet();
        for (Map.Entry<String, Student> studentEntry : entrySet) {
            String key = studentEntry.getKey();
            Student student = studentEntry.getValue();
            System.out.println("key值为"+key+"学生对象为"+student);
        }


    }
}

